// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.node.getChildByName('test').on(cc.Node.EventType.TOUCH_END,this.btn_video.bind(this,'123'));//返回按键
        this.node.getChildByName('test').off(cc.Node.EventType.TOUCH_END);
        this.node.getChildByName('test').on(cc.Node.EventType.TOUCH_END,this.btn_video.bind(this,'1234'));//返回按键
        
        //this.node.getChildByName('test').on(cc.Node.EventType.TOUCH_END,this.btn_video,this);//返回按键
    }

    btn_video(data){
        console.log('>>>>>>>>>>>>>>>>aaa',data);
    }
    start () {
        //this.node.addComponent(cc.SafeArea);
        let asd = cc.sys.getSafeAreaRect();
        console.log('>>>>>>>>>>>>>>>>',asd);
        //this.node.getChildByName('test').on(cc.Node.EventType.TOUCH_END,this.btn_video,this);//返回按键
    }

    // update (dt) {}
}
